import dotenv from 'dotenv'
import path from 'path'
import { __dirname } from '../utils/common.ts'

const env = process.env.NODE_ENV || 'development'
const envFile = path.resolve(__dirname(), `../../.env.${env}`)

const result = dotenv.config({ path: envFile })

if (result.error) {
  console.warn(`Failed to load env file: ${envFile}`, result.error)
}

export default process.env
